<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <style>
      #shaizi {
        width: 325px;
        height: 225px;
        border: black 1px solid;
        display: flex;
        flex-wrap: wrap;
        justify-content: space-between;
        align-items: center;
      }
      #shaizi > div {
        width: 100px;
        height: 100px;
        border: rgb(226, 15, 15) 1px solid;
        display: flex;
        padding: 5px;
        box-sizing: border-box;
      }
      .red,
      .blue {
        width: 25px;
        height: 25px;
        border-radius: 50%;
      }
      .red {
        background-image: radial-gradient(red, black);
      }
      .blue {
        background-image: radial-gradient(blue, black);
      }
      #s1 {
        justify-content: center;
        align-items: center;
      }
      #s2 {
        flex-direction: column;
        justify-content: space-evenly;
        align-items: center;
      }
      #s3 {
        flex-direction: column;
        justify-content: space-between;
      }
      #s3 div:nth-of-type(2) {
        align-self: center;
      }
      #s3 div:nth-of-type(3) {
        align-self: flex-end;
      }
      #s4 {
        justify-content: space-around;
      }
      #s4 .column {
        display: flex;
        flex-direction: column;
        justify-content: space-around;
      }
      #s5 {
        justify-content: space-around;
      }
      #s5 .column {
        display: flex;
        flex-direction: column;
        justify-content: space-around;
      }
      #s6 {
        justify-content: space-around;
      }
      #s6 .column {
        display: flex;
        flex-direction: column;
        justify-content: space-around;
      }
      #s5 > div:nth-of-type(2) {
        /* position:absolute只是为了脱离文档流 */
        /* absolute定位的元素不参与flex的布局，但是很多浏览器允许这样做。 */
        position: absolute;
        align-self: center;
      }
    </style>
  </head>

  <body>
    <div id="shaizi">
      <div id="s1">
        <div class="red"></div>
      </div>
      <div id="s2">
        <div class="blue"></div>
        <div class="blue"></div>
      </div>
      <div id="s3">
        <div class="blue"></div>
        <div class="blue"></div>
        <div class="blue"></div>
      </div>
      <div id="s4">
        <div class="column">
          <div class="red"></div>
          <div class="red"></div>
        </div>
        <div class="column">
          <div class="red"></div>
          <div class="red"></div>
        </div>
      </div>
      <div id="s5">
        <div class="column">
          <div class="blue"></div>
          <div class="blue"></div>
        </div>
        <div class="blue"></div>
        <div class="column">
          <div class="blue"></div>
          <div class="blue"></div>
        </div>
      </div>
      <div id="s6">
        <div class="column">
          <div class="blue"></div>
          <div class="blue"></div>
          <div class="blue"></div>
        </div>
        <div class="column">
          <div class="blue"></div>
          <div class="blue"></div>
          <div class="blue"></div>
        </div>
      </div>
    </div>
  </body>
</html>
